package com.yangrong.thread.chapter11;

public class ExecutionTask implements Runnable {

	private QueryFromDBAction queryAction = new QueryFromDBAction();

	private QueryFromHttpAction httpAction = new QueryFromHttpAction();

	@Override
	public void run() {
//		final Context context = new Context();
//		queryAction.execute(context);
		queryAction.execute();
		System.out.println("The name query successful");
//		httpAction.execute(context);
		httpAction.execute();
		System.out.println("The card id query successful");
		
		// 如果是线程池，在getContext时需要先清理
		Context context = ActionContext.getActionContext().getContext();
		System.out.println("The Name is " + context.getName() + " and id " + context.getCardId());
	}

}
	